//
//  ConsultantController.m
//  LuCaiZhu
//
//  Created by 邓龙 on 2019/4/11.
//

#import "ConsultantController.h"
#import "HandleNetProduct+Transaction.h"
#import "UIColor+NN.h"
#import "UserModel.h"

@interface ConsultantController ()
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UIButton *bottomBtn;

@property (nonatomic, copy) NSString *phone;

@end

@implementation ConsultantController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"联系财富顾问";
    
    _bottomBtn.layer.borderWidth = 1;
    _bottomBtn.layer.borderColor = [UIColor colorWithHexString:@"#ececec"].CGColor;
    _bottomBtn.layer.cornerRadius = 2;
    
    [self getRansomHelpAction];
}

//赎回财富顾问
- (void)getRansomHelpAction {
    UserModel *model=[UserModel getUser];
    int mid=[model.CustomerID intValue];
    [HandleNetProduct getRansomHelpCustomerId:mid Success:^(NSArray * _Nonnull data) {
        if (data.count > 0) {
            _name.text =  data.firstObject[@"UserName"];
            _phone = data.firstObject[@"Phone"];
        }
    } Failure:^(NSString * _Nonnull errorInfo) {
        
    }];
}

- (IBAction)clickBottomAction:(UIButton *)sender {
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",_phone];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}


@end
